-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proof of concept X-Poedit-Potfile header #79
base: master
Are you sure you want to change the base?
Conversation
Catalog::Update will first check if a potfile has been set, otherwise it will SourceDig
I don't know what to think about this :( I understand your point about the UI and yes, it would be nice if the Update button did the right thing (doubly so for users not familiar with all this gettext stuff), but on the other hand:
|
Eg. developing in CakePHP, the pot files are not alongside the po files but two directories up, which makes hand-selecting them a nuisance (adding to the clicks needed to open the menu and select "Update from POT"). I understand the reluctancy to have to many private headers. I don't know anything about the OSX Sandbox rules, but is doesn't feel that different from going through the sources of a project? |
For the record, that's an incredibly stupid idea on their part (if that actually is CakePHP's requirement). Why? Because entries in the PO(T) contain references — i.e. relative(!) filenames and line numbers — to where the strings are used in the code; this information is used by some translators to better understand the context. If you put POs created from the POT into a different directory, you completely break all the references.
To be honest, that makes even less sense. To be clear, while I'm reluctant to add
What about something like this?
What I meant was that in the sandbox, the user needs to explicitly choose files/directories that the application may access. For sources scanning, I do this by asking for the permission to the entire source tree, but if all I need is access to a single POT file, it's better to ask the user only for that (and speaking as a user, I wouldn't feel comfortable if an app I use demanded more permissions than it apparently needed). Anyway, the above scheme is sandbox friendly, but more importantly, I think it's also better in that it works with any POs and also makes it clear what's going on. What do you think? |
The suggested steps seem fine. I don't think I mind where Poedit stores the POT-PO relation... All together it would streamline my workflow a lot. I'll see if I can relay your opinion to the CakePHP developers :-) |
Hi! TL;DR:
If this functionality seems interesting enough, I'll open a feature request issue. Longer thing about CakePHP and its translation system When CakePHP i18n functionnality extracts the strings from the sources to create the .pot files, the relative path is well kept, so there is no issue with bad sources links in Poedit. The "weird" part may be the following structure: Locale/
+ <domain>.pot files (extracted from sources, may be language agnostic)
+ fr_FR/ (actual translation)
+ <domain>.mo files
+ <domain>.po files
+ en_EN/ (actual translation)
+ <domain>.mo files
+ <domain>.po files
+ ... It's done this way because of the number of possible domains and the fact that cake looks in the |
Don’t open any duplicates, please. You’re free to open a pull request actually implementing it, though. FWIW, I don’t recommend doing it in the manager: it’s an unmaintained, deprecated piece of crap. There’s really no reason why this shouldn’t be autodetected smartly as per my previous comment (including a CakePHP special case, because it’s no trouble for Poedit to look one level up for a POT if it can’t find it alongside the translation file).
None of this has bearing on this issue and is run-of-the-mill standard use of domains (modulo possible abuse of them when the same source tree — i.e. a domain — is artificially split into multiple gettext domains) and doesn’t really explain the peculiar choices (both standard Unix approach and WordPress’ one are domains-aware, yet don’t need to do this).
(BTW, I recommend reading up on “message contexts”, a long-time standard gettext feature that is actually meant for exactly this particular purpose…) |
Hello,
When using Poedit, I usually have projects with pot files.
With the "Update from POT File" I always have to navigate to the pot file (which is always in the same location for a project).
I decided I'd try a proof-of-concept X-Poedit-Potfile header storing the location of the pot file. See changes (I do not regularly program C...)
I've only tested this on MacOS X with a relative path (and no BaseDir set).
What's your opinion?